<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>用户</title>
<style type="text/css">
.gallery-list a {
    color: #FFF;
}
</style>
<script type="text/javascript">
//初始化下拉框
$.ajax({
	url: "management/role/listRole",
	type:"POST",
	success:function(data){
		$(data).each(function(n){
            $("<option/>").html(this.name).val(this.roleId)
            .appendTo("#roleId");
        });
		$("#roleId").val('${t.roleId}');
	}
});
function deletePhoto(_this,id){
	//alert("我的外层的外层是："+_this.parentNode.parentNode.tagName);
	//alert("我的外层的外层的id是："+_this.parentNode.parentNode.id);
	//_this.parentNode.parentNode.remove();
	if (id == "") {
		layer.msg("请选择删除项！！");
		return;
	}
	layer.confirm('是否删除？', function(index) {
		var url = "management/employee/worksdelete/"+id;
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			success : function(data) {
				layer.msg(data.msg);
				if (data.success) {
					_this.parentNode.parentNode.remove();
				}
			}
		});
	});
	
}
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/employee/worksindex">作品库及休息日管理</a></li>
		<li class="am-active">作品库管理</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
			<input id="id" name="employeeId" type="hidden" value="${t.employeeId }">
				<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">员工作品</a></li>
						<!-- <li class="am-active"><a href="javascript:void(0)">作品库</a></li> -->
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-g">
								<div class="am-u-md-12">
									<form class="am-form am-form-horizontal">
									<input id="id" name="employeeId" type="hidden" value="${t.employeeId }">
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">账号</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="account" name="account" value="${t.account}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">角色</label>
										<div class="am-u-md-4 am-u-end">
											<select id="roleId" name="roleId" readonly>
												<option value="">请选择角色</option>
											</select>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">所属门店</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="shopName" name="shopName" value="${t.shopName}" class="am-form-field am-input-sm" readonly>
											<input type="hidden" id="shopId" name="shopId" value="${t.shopId}" class="am-form-field am-input-sm">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">姓名</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="name" name="name" value="${t.name}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">联系电话</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="phone" name="phone" value="${t.phone}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">性别</label>
										<div class="am-u-sm-4 am-u-end am-form-label am-text-left">
											<input type="radio" name="sex" <c:if test="${t.sex eq 'M'}"> checked="checked" </c:if> value="M" disabled="disabled"> 男
											<input type="radio" name="sex" <c:if test="${t.sex eq 'F'}"> checked="checked" </c:if> value="F"  disabled="disabled"> 女
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">月业绩目标</label>
										<div class="am-u-md-4 am-u-end">
											<input type="number" id="target" name="target" value="${t.target}" class="am-form-field am-input-sm" readonly="readonly">
										</div>
									</div>
									</form>
									<hr>
									<c:if test="${empty workslist }">
										<label>员工还没有作品</label>
									</c:if>
									<c:if test="${!empty workslist }">
										<label>员工作品展示</label>
									</c:if>
									<div class="am-avg-sm-2 am-avg-md-4 am-avg-lg-6 am-margin gallery-list">
										<c:forEach var="works" items="${workslist}">
											<div class="am-u-md-4 am-u-end">
												<img id="imgId" src="${works.photo }" class="am-form-field am-input-sm">
												<div class="gallery-title">作品名称：${works.name }</div>
												<div class="gallery-desc">
													<a href="management/employee/worksedit/${works.worksId }" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-check"></span> 修改</a>
													<a href="javascript:;" onclick="deletePhoto(this,'${works.worksId}')" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 删除</a>
												</div>
												<br>
											</div>
										</c:forEach>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="am-margin">
					<a href="management/employee/worksadd/${t.employeeId }" class="am-btn am-btn-primary am-btn-xs" ><span class="am-icon-check"></span> 新增作品</a>
					<a href="management/employee/worksindex" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 返回</a>
				</div>
		</div>
	</div>
</body>
</html>
